package br.brpv.silvestrin.vendas.util;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import br.brpv.silvestrin.vendas.R;

public class ShowMessage {

    public static void alertDialog(Context activity, int textId){

        AlertDialog.Builder builder = new AlertDialog.Builder(activity);

        builder.setMessage(textId)
                .setCancelable(false)
                .setNeutralButton(R.string.dialog_back, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int which) {
                    }
                })
                .create()
                .show();
    }

    public static void alertDialog2(Context activity, int textId, OnClickListener listener){

        AlertDialog.Builder builder = new AlertDialog.Builder(activity);

        builder.setMessage(textId)
                .setCancelable(false)
                .setNegativeButton(R.string.dialog_back, listener)
                .setPositiveButton(R.string.dialog_retry, listener)
                .create()
                .show();
    }

    public static void alertDialog2(Context activity, String message, OnClickListener listener){

        AlertDialog.Builder builder = new AlertDialog.Builder(activity);

        builder.setMessage(message)
                .setCancelable(false)
                .setNegativeButton(R.string.dialog_back, listener)
                .setPositiveButton(R.string.dialog_retry, listener)
                .create()
                .show();
    }

    public static void alertDialog(Activity activity, String error) {
        AlertDialog.Builder builder = new AlertDialog.Builder(activity);

        builder.setMessage(error)
                .setCancelable(false)
                .setNeutralButton(R.string.dialog_back, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int which) {
                    }
                })
                .create()
                .show();

    }

    public static void alertDialogSaved(Context activity, int textId, OnClickListener listener){

        AlertDialog.Builder builder = new AlertDialog.Builder(activity);

        builder.setMessage(textId)
                .setCancelable(false)
                .setNegativeButton(R.string.dialog_no, listener)
                .setPositiveButton(R.string.dialog_yes, listener)
                .create()
                .show();
    }
}
